import { usePost, useGet } from '@/utils/request'

/**
 * 提交题目
 * @param params - 提交数据
 */
export const problemSubmitApi = (params: API.Problem.ProblemSubmitRequest) => {
  return usePost<number, API.Problem.ProblemSubmitRequest>('/problem/submit', params)
}


/**
 * 分页获取题目提交记录列表（用户端）
 * @param params - 查询参数
 */
export const getSubmitListPageVoApi = (params: API.Problem.SubmitQueryRequest) => {
  return usePost<API.Problem.SubmitVoPage, API.Problem.SubmitQueryRequest>('/problem/submit/my/list/page', params)
}

/**
 * 获取提交详情
 * @param id - 提交记录ID
 */
export const getSubmitDetailApi = (id: number) => {
  return useGet<API.Problem.SubmitVo>(`/problem/submit/get/${id}`)
} 

/**
 * 获取用户语言提交统计
 */
export const getUserLanguageSubmitApi = () => {
  return useGet<API.Problem.UserLanguageSubmitVo[]>(`/problem/get/language/submit/count`)
} 

/**
 * 获取最近提交的题目列表
 */
export const getRecentlySubmittedListApi = () => {
  return useGet<API.Problem.RecentPassVo[]>(`/problem/get/recently/submit/list`)
}
